#!/bin/sh

[ "$ACTION" = ifup ] || exit 0

device=$(ip route show 0/0 | sed -e 's/.* dev \([^ ]*\).*/\1/')

[ -z "$device" -o "$DEVICE" = "$device" ] || exit 0

/etc/init.d/shadowvpn restart
logger -t ShadowVPN "Restart ShadowVPN due to ifup of $INTERFACE ($DEVICE)"
